<?php
include_once 'config.php';
function create_db($DB_NAME){
	$db=new SQLiteDatabase($DB_NAME);
	$db->query("BEGIN;
	create table users(
 	username varchar(20) primary key,
  	password varchar(100) not null
	);
	COMMIT;");
	$db->query("BEGIN;
	create table stock_history(
  	transaction_id INTEGER PRIMARY KEY,
  	quality INTEGER ,
  	stock varchar(20) not null,
  	transaction_date date,
 	transaction_type varchar(10),
  	username varchar(20) not null,
  	value INTEGER
	);
	COMMIT;");
	$db->query("BEGIN;
	create table residual_stock(
  	residual_stock_id INTEGER PRIMARY KEY,
  	username varchar(20) not null,
  	stock varchar(20) not null,
  	quality INTEGER ,  
  	value INTEGER
	);
	COMMIT;");
}
create_db($DB_NAME);
?>